package com.gm.wholesale.module.good.api;

import android.util.ArrayMap;

import com.gm.commonlib.base.baseBean.BaseListResp;
import com.gm.commonlib.base.baseBean.BasePageData;
import com.gm.commonlib.base.baseBean.BaseResp;
import com.gm.commonlib.base.baseBean.DataResp;
import com.gm.wholesale.module.good.bean.CreateGoodReq;
import com.gm.wholesale.module.good.bean.GoodBean;
import com.gm.wholesale.module.good.bean.GoodDetailBean;
import com.gm.wholesale.module.good.bean.GoodListBean;
import com.gm.wholesale.module.kind.bean.KindBean;

import io.reactivex.Observable;
import retrofit2.http.Body;
import retrofit2.http.DELETE;
import retrofit2.http.GET;
import retrofit2.http.POST;
import retrofit2.http.PUT;
import retrofit2.http.Path;
import retrofit2.http.QueryMap;

public interface IGoodApi {
    //todo 获取商品分类
    @GET("pda/api/v1/category")
    Observable<BaseListResp<KindBean>> getCategory(@QueryMap ArrayMap<String,String> data);

    // todo 获取临时商品
    @GET("pda/api/v1/sku/temporary")
    Observable<DataResp<GoodBean>> getTemporary();



    //todo 获取商品by名字和单位
    @GET("pda/api/v1/sku/byName")
    Observable<BaseListResp<GoodBean>> getGoodByName(@QueryMap ArrayMap<String,Object> data);

    //创建商品
    @POST("pda/api/v1/sku")
    Observable<BaseResp> createGood(@Body CreateGoodReq createGoodReq);


    //获取商品列表
    @GET("pda/api/v1/sku")
    Observable<BasePageData<GoodListBean>> getGoodList(@QueryMap ArrayMap<String,Object> data);


    //获取商品列表(todo 主界面使用，不想修改了，多谢个接口，后面接口数据结构变了)
    @GET("pda/api/v1/sku")
    Observable<BasePageData<GoodBean>> getGoods(@QueryMap ArrayMap<String,Object> data);

    //删除商品
    @DELETE("pda/api/v1/sku/{id}")
    Observable<BaseResp> deleteGood(@Path ("id") long id,@QueryMap ArrayMap<String,Object> data);


    //修改商品状态，上架下架
    @PUT("pda/api/v1/sku/{id}/onShelf")
    Observable<BaseResp> updateGoodState(@Path ("id") long id,@Body ArrayMap<String,Object> data);


    //获取商品详情
    @GET("pda/api/v1/sku/{id}")
    Observable<DataResp<GoodDetailBean>> getGoodDetail(@Path ("id") long id);


    //修改商品
    @PUT("pda/api/v1/sku/{id}")
    Observable<BaseResp> updateGood(@Path ("id") long id,@Body CreateGoodReq createGoodReq);



}
